package jia.game;

import jia.core.EventProcessor;
import jia.core.GameStateManager;
import jia.core.InputProcessor;
import jia.core.UiManager;

/**
 * Abstract class that defines the necessary attributes any concrete game class must have.  This
 * is essentially a "registering" mechanism, so that during the course of normal operation there
 * are usable hooks into the various managers and processors to facilitate game functions
 * @author Alec Lanter
 * @version 1.0
 * @since 1/1/2006
 */
public abstract class AbstractGame {
    
    /**
     * huh
     * @since 12/12/2007
     */
    protected GameStateManager gameState;
    protected InputProcessor inputProcessor;
    protected UiManager uiManager;
    protected EventProcessor eventProcessor;
    
    protected abstract GameStateManager createGameState();
    
    protected abstract InputProcessor createInputProcessor();
    
    protected abstract UiManager createUiManager();
    
    protected abstract EventProcessor createEventProcessor();
    
    protected abstract void initGame();
    
    /**
     * Default Constructor
     */
    public AbstractGame() {
        gameState = createGameState();
        inputProcessor = createInputProcessor();
        uiManager = createUiManager();
        eventProcessor = createEventProcessor();
        gameState.registerEventProcessor(eventProcessor);
        gameState.registerUiManager(uiManager);
        inputProcessor.registerGameState(gameState);
        uiManager.registerInputProcessor(inputProcessor);
    }
}
